package com.geeklan.smart.ui;

import android.content.Intent;
import android.net.Uri;

import androidx.annotation.Nullable;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.geeklan.base.base.BaseActivity;
import com.geeklan.smart.R;
import com.geeklan.smart.databinding.ActivityTestBinding;
import com.geeklan.smart.ui.dialog.DateBottomSheetDialog;
import com.zhihu.matisse.Matisse;

import java.util.List;

public class TestActivity extends BaseActivity<ActivityTestBinding> {

    @Override
    protected ActivityTestBinding initBinding() {
        return ActivityTestBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void initData() {
//        loading("loading...");

//        HorizontalRulerView rulerView = findViewById(R.id.horizontalRuler);
//        rulerView.setRange(50, 100, 1);

//        int selectedValue = rulerView.getSelectedValue(); // 获取当前选中值

//        CustomBarChart customBarChart = findViewById(R.id.customBarChart);
//        customBarChart.setChartData();

//        EditTextAlertDialog editTextAlertDialog = new EditTextAlertDialog(this,"你好啊",null,getString(R.string.confirm));
//        editTextAlertDialog.setHint("这是一个输入框");
//        editTextAlertDialog.show();

//        FoodBottomSheetDialog foodBottomSheetDialog = new FoodBottomSheetDialog(this);
//        foodBottomSheetDialog.setCancelableOutside(true); // 点击背景关闭
//        foodBottomSheetDialog.setDraggable(false);
//        foodBottomSheetDialog.show();

//        WeekBottomSheetDialog weekBottomSheetDialog = new WeekBottomSheetDialog(this);
//        weekBottomSheetDialog.setCancelableOutside(true); // 点击背景关闭
//        weekBottomSheetDialog.show();

//        DateBottomSheetDialog dateBottomSheetDialog = new DateBottomSheetDialog(this);
//        dateBottomSheetDialog.setCancelableOutside(true); // 点击背景关闭
//        dateBottomSheetDialog.setOnDateSelectedListener((year, month, day) -> {
//
//        });
//        dateBottomSheetDialog.show();

//        SmartFoodBottomSheetDialog smartFoodBottomSheetDialog = new SmartFoodBottomSheetDialog(this);
//        smartFoodBottomSheetDialog.show();

//        Matisse.from(this)
//                .choose(MimeType.ofImage()) // 选择所有类型的文件（图片、视频等）
//                .countable(true) // 允许选择多个文件
//                .maxSelectable(10) // 限制最多选择 10 张图片
//                .thumbnailScale(0.85f) // 缩略图缩放
//                .imageEngine(new GlideEngine()) // 使用 Glide 加载图片
//                .forResult(REQUEST_CODE_CHOOSE); // 请求码

//        LoginOutAlertDialog loginOutAlertDialog = new LoginOutAlertDialog(this, "验证信息");
//        loginOutAlertDialog.setOnPositiveButtonClickListener(v -> {
//            loginOutAlertDialog.dismiss();
//        });
//        loginOutAlertDialog.setOnDismissListener(dialog -> {
//
//        });
//        loginOutAlertDialog.show();


    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK && requestCode == REQUEST_CODE_CHOOSE) {
            List<Uri> selectedUris = Matisse.obtainResult(data); // 获取选择的图片列表
            // 你可以在这里处理选中的图片，如显示或上传
        }
    }


    @Override
    protected void initView() {

    }

    @Override
    protected void onApplyWindowInsets() {
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
    }

    @Override
    public void networkStatus(boolean isConnected) {

    }

    @Override
    public void networkType(int type) {

    }
}